<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ page import="org.tobuy.factory.*" import="org.tobuy.vo.*"%>
<%@ page import="java.util.ArrayList" import="java.util.List"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Welcome to tobuy.com!</title>
  	<style type ="text/css">
  		#container{
  		width:900px;
  		margin-left:auto;
  		margin-right:auto;
  		}
  		#fronter{
  		width:900px;
  		margin:0px;
  		}
  		#content{
  		margin-left:auto;
  		margin-right:auto;
  		}
  		ul{
  		list-style-type: none;
  		padding:0px;
  		margin:0px;
  		
  		}
  		li{
  			float:left;
  			padding-right:10px;
  		}
  		.gray{
	
	width:32px;
	height:32px;
	background-image:url(star_gray.png);
}

.yellow{
	
	width:32px;
	height:32px;
	background-image:url(star_yellow.png);
}
.yellow:hover{
	
	width:32px;
	height:32px;
	background-image:url(star_blue.png);
}
.gray:hover{
	
	width:32px;
	height:32px;
	background-image:url(star_blue.png);
}
  		
  	</style>

  </head>
  
  <body>
  <div id="container">
  
  <div id="fronter">
  	<a href="index.jsp"><img src="logo.png"></a>
  <%
  	User user = (User)session.getAttribute("user");
  	String action = (String)request.getParameter("action");
    if(user == null){
  %>
  		<h3 id="">Welcome guest! Please login or <a href="index.jsp?action=reg">registrate</a>, <a href="index.jsp?action=admin_login">Admin Login</a></h3>
 		<form action="LoginServlet" method="post">
   			<span>E-mail:</span><input type="text" name="userid">
   			<span>Password:</span><input type="password" name="userpass">
   			<input type="submit" value="submit">
  			<input type="reset" value="reset">
   		</form>	
  <%
  	}else{
  %>
  		<h3>Welcome <%=user.getUser_name()%>, feel free to browse!</h3>
  		<ul>
  			<li><a href="ShowUserInfo?user_id=<%=user.getUser_id() %>">My Info</a></li>
  			<li><a href="index.jsp">Show all Item</a></li>
  			<li><a href="index.jsp?action=createItem">Sell stuff</a></li>
  			<li><a href="ShowAuction">Auctions</a></li>
  			<li><a href="index.jsp?action=purschasHistory">Purchase history</a></li>
  			<li><a href="index.jsp?action=soldHistory">Sold items</a></li>
  			<li><a href="logout.jsp">Logout</a></li>
  		</ul>
  	<br>
  	</div>
  	<div id="content">
  <%
  	}
  	if(action==null){
  %>
  		<jsp:include page="showItems.jsp"></jsp:include>
  <%
  	}
  	if("createItem".equals(action)){
  %>
  		<jsp:include page="createItem.jsp"></jsp:include>
  <%
  	}
  	if("purschasHistory".equals(action)){
  %>
  		<jsp:include page="purchaseHistory.jsp"></jsp:include>
  <%
  	}
  	if("showItemInfo".equals(action)){
  %>
  		<jsp:include page="showItemInfo.jsp"></jsp:include>
  <%
  	}
  	if("soldHistory".equals(action)){
  %>
  		<jsp:include page="soldHistory.jsp"></jsp:include>
  <%
  	}
	if("showUserInfo".equals(action)){
  %>
  		<jsp:include page="showUserInfo.jsp"></jsp:include>
  <%
  	}
  		if("showAuction".equals(action)){
  %>
  		<jsp:include page="showAuction.jsp"></jsp:include>
  <%
  	}
  	if("showAuctionDetail".equals(action)){
  %>
  		<jsp:include page="showAuctionDetail.jsp"></jsp:include>
  <%
  	}
  	if("offerPriceResult".equals(action)){
  %>
  		<jsp:include page="offerPriceResult.jsp"></jsp:include>
  <%
  	}
  	if("reg".equals(action)){
  %>
  		<jsp:include page="registration.jsp"></jsp:include>
  <%
  	}
  	if("reg_pass".equals(action)){
  %>
  		<jsp:include page="Registration_pass.jsp"></jsp:include>
  <%
  	}
  	if("admin_login".equals(action)){
  %>
  		<jsp:include page="admin_login.jsp"></jsp:include>
  <%
  	}
  %>
	</div>
</div>
  </body>
</html>
